<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./font-awesome-4.7.0/css/font-awesome.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1437112_e8nfviri4c4.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1438060_ob992ttlg1.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1438081_l8g61gv0ta.css">
    <style>
        body {
            min-width: 1200px;
            overflow: hidden;
            position: relative;
        }

        #sidebar {
            margin-top: 62px;
            width: 16%;
            height: 800px;
            /* border: 1px solid red; */
            overflow: hidden;
            background: #20222a;
            float: left;
        }

        .logo {
            width: 16%;
            height: 62px;
            /* background: red; */
            background: url("./img/logo.png") 20% no-repeat;
            position: absolute;
            left: 0;
            top: 0;
            background-size: 50%;
        }

        #sidebar p {
            width: 100%;
            height: 62px;
            color: white;
            line-height: 60px;
            cursor: pointer;
            background: #20222a;

        }

        .analyze {
            width: 100%;
            height: 62px;
            color: white;
            line-height: 60px;
            cursor: pointer;
            background: #20222a;
            padding-left: 80px;

        }

        #sidebar p:hover {
            border-left: 3px solid #3c9688;
        }

        #sidebar p span {
            margin-left: 80px;
        }

        .a1 {

            height: 248px;
            background: #3c9688;
            color: white;
            line-height: 60px;
            cursor: pointer;
            text-align: center;
            display: none;
            text-align: center;
        }

        #top {
            width: 83%;
            height: 62px;
            /* border: 1px solid red; */
            float: left;
        }

        #top p {
            float: right;
            margin-right: 1%;
            line-height: 60px;
            font-size: 14px;
            float: right;
            margin-right: 2%;
            color: #696969;
            cursor: pointer;
        }

        iframe {
            width: 83%;
            height: 700px;
        }
    </style>
</head>

<body>
    <div class="logo">
    </div>
    <div id="sidebar">

        <p> <span class="icon iconfont icon-shouye"></span> 首页</p>
        <p> <span class="fa fa-mortar-board"></span> 院校管理</p>
        <p> <span class="icon iconfont icon-xueshengguanli"></span> 学生管理</p>
        <p> <span class="icon iconfont icon-yejiguanli"></span> 业绩管理 </p>
        <div class="analyze"> <span class="icon iconfont icon-shujufenxi"></span> 数据分析
            <span id="ospan" class="icon iconfont icon-triangle-bottom"></span></div>
        <ul class="a1">
            <p>市场统计</p>
            <p>口碑统计</p>
            <p>就业统计</p>
            <p>就业率统计</p>
        </ul>
        <p> <span class="icon iconfont icon-icon-test"></span> 提醒功能</p>

    </div>
    <div id="top">
        <p>退出</p>
        <p>量子矩阵</p>
    </div>
    <iframe src="./homepage.html" frameborder="0"></iframe>
</body>

</html>
<script>
    var analyze = document.getElementsByClassName("analyze");
    var oa = document.getElementsByClassName("a1");
    var ospan = document.getElementById("ospan");
    var iFrame = document.getElementsByTagName("iframe")[0];
    for (var i = 0; i < analyze.length; i++) {
        analyze[i].index = i;
        analyze[i].onoff = true;
        analyze[i].onclick = function () {
            if (this.onoff) {
                oa[this.index].style.display = "block";
                ospan.className = "icon iconfont icon-triangle-top";
                analyze[this.index].onoff = false;
            } else {
                oa[this.index].style.display = "none";
                ospan.className = "icon iconfont icon-triangle-bottom";
                analyze[this.index].onoff = true;
            }

        }
    }
    //点击变色
    var osidebar = document.getElementById("sidebar");
    var op = osidebar.getElementsByTagName("p");
    op[0].style.background = "#3c9688";
    for (var i = 0; i < op.length; i++) {
        console.log(2)
        op[i].index = i;
        op[0].onclick = function () {
            for (var j = 0; j < op.length; j++) {
                op[j].style.background = '';
            }
            this.style.background = "#3c9688";
            iFrame.src = "homepage.html";
        }
    }
    op[1].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "BX_schoolManage.html";
        this.style.background = "#3c9688";
    }
    op[2].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "homepage.html";
        this.style.background = "#3c9688";
    }
    op[3].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "homepage.html";
        this.style.background = "#3c9688";
    }
    op[4].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "BX_schoolManage.html";
        this.style.background = "#3c9688";
    }
    op[5].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "homepage.html";
        this.style.background = "#3c9688";
    }
    op[6].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "BX_schoolManage.html";
        this.style.background = "#3c9688";
    }
    op[7].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "homepage.html";
        this.style.background = "#3c9688";
    }
    op[8].onclick = function () {
        for (var j = 0; j < op.length; j++) {
            op[j].style.background = '';
        }
        iFrame.src = "homepage.html";
        this.style.background = "#3c9688";
    }
</script>